package com.crealth.db;

import java.util.List;
import com.crealth.manager.MybatisManager;
import com.crealth.model.KnowledgePledgetLoanModel;

public class KnowledgePledgetLoanDb {

	public static void insertKnowledgePledgetLoan(KnowledgePledgetLoanModel pledgetKnowledge) {
		MybatisManager.pledgetKnowledgeMapper.insertKnowledgePledgetLoan(pledgetKnowledge);
		MybatisManager.commit();
	}
    
    public static List<KnowledgePledgetLoanModel> selectAllKnowledgePledgetLoan() {
    	List<KnowledgePledgetLoanModel> pledgetKnowledgels =
    			MybatisManager.pledgetKnowledgeMapper.selectAllKnowledgePledgetLoan();
    	
    	return pledgetKnowledgels;
    }
    
    public static List<KnowledgePledgetLoanModel> selectCityNameKnowledgePledgetLoan(String cityName) {
    	List<KnowledgePledgetLoanModel> pledgetKnowledgels =
    			MybatisManager.pledgetKnowledgeMapper.selectCityNameKnowledgePledgetLoan(cityName);
    	
    	return pledgetKnowledgels;
    }
    
    public static KnowledgePledgetLoanModel selectKnowledgePledgetLoanByName(String name) {
    	KnowledgePledgetLoanModel klg = MybatisManager.pledgetKnowledgeMapper.selectKnowledgePledgetLoanByName(name);
    	
    	return klg;
    }
    
    public static Integer updateKnowledgePledgetLoanByID(KnowledgePledgetLoanModel pledgetKnowledge) {
    	Integer res = MybatisManager.pledgetKnowledgeMapper.updateKnowledgePledgetLoanByID(pledgetKnowledge);
    	MybatisManager.commit();
    	
    	return res;
    }
    
    public static Integer deletePledgetKnowledgeByID(int id) {
    	Integer res = MybatisManager.pledgetKnowledgeMapper.deletePledgetKnowledgeByID(id);
    	MybatisManager.commit();
    	
    	return res;    	
    }
	
}
